﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CERefresher : MonoBehaviour
{
    // Start is called before the first frame update
    public bool IsOwnSide = true;
    public bool IsExposed = true;
    Side m_Side;
    Card m_Card;

    [Range(0,5)]
    public int Index = 0;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(IsOwnSide)
            m_Side = VSController.Instance.GetCurrSide();
        else 
            m_Side = VSController.Instance.GetOppositeSide();
        if(IsExposed)
            m_Card = m_Side.ExposedField[Index];
        else 
            m_Card = m_Side.HiddenField[Index];
        if(m_Card == null) GetComponent<MeshRenderer>().enabled = false;
        else {
            GetComponent<MeshRenderer>().enabled = true;
            GetComponent<TextMesh>().text = m_Card.CE.ToString();
        }
    }
}
